﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;

namespace LOGIN
{
    public partial class mark : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["name"] == null)
            {
                Response.Redirect("index.aspx");
            }
            else this.login.Text = "" + Session["name"].ToString() + "同学，你已经成功进入登录页面";
            string strCn = "server=pc.hstc.cn;database=dhd2014112122;uid=2014112122;pwd=19950123";
            SqlConnection cn = new SqlConnection(strCn);
            try
            {
                cn.Open();
                this.lblName.Text = "" + Session["name"].ToString() + "同学，你的成绩如下：";
                string strSql = "SELECT   Chinese_mark, Math_mark, English_mark  FROM      Login  WHERE   (Name = N'" + Session["name"].ToString() + "')";
                SqlCommand cmd = new SqlCommand(strSql, cn);
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    this.lblChi.Text = dr["Chinese_mark"].ToString();
                    this.lblMath.Text = dr["Math_mark"].ToString();
                    this.lblEng.Text = dr["English_mark"].ToString();
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                this.lblInfo.Text = ex.Message;
            }
            finally
            {
                cn.Close();
            }
        }

        protected void exit_Click(object sender, EventArgs e)
        {

            Response.Redirect("index.aspx");
        }

        protected void update_Click(object sender, EventArgs e)
        {
            Response.Redirect("Change_stu.aspx");
        }

        protected void information_Click(object sender, EventArgs e)
        {
            Response.Redirect("mark.aspx");
        }
        protected void text_Click(object sender, EventArgs e)
        {

        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("Main_Stu.aspx");
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Session["Theme"] = this.DropDownList1.SelectedValue.ToString();
        }

        protected void Page_PreInit(object sender, EventArgs e)
        {
            if (Session["Theme"] != null)
                this.Theme = Session["Theme"].ToString();
        }
    }
}